package com.qdxht.dispenser.utils;

import android.content.Context;
import android.content.Intent;

public class BroadcastUtil {

    public static final String ACTION_CONTENT = "content";
    public static final String ACTION_SET_AD = "com.qdxht.dispenser.ACTION_SET_AD";
    public static final String ACTION_ENABLE_DEVICE = "com.qdxht.dispenser.ACTION_ENABLE_DEVICE";
    public static final String ACTION_QRCODE = "com.qdxht.dispenser.ACTION_QRCODE";
    public static final String ACTION_INVENTORY = "com.qdxht.dispenser.ACTION_INVENTORY";
    public static final String ACTION_TIMERSWITCH = "com.qdxht.dispenser.ACTION_TIMERSWITCH";
    public static final String ACTION_DOWNLOAD_UPDATE = "com.qdxht.dispenser.ACTION_DOWNLOAD_UPDATE";

    public static void sendSetAdBroadcast(Context context, String contentJson) {
        Intent intent = new Intent(ACTION_SET_AD);
        intent.putExtra(ACTION_CONTENT, contentJson);
        context.sendBroadcast(intent);
    }

    public static void sendEnableDeviceBroadcast(Context context) {
        Intent intent = new Intent(ACTION_ENABLE_DEVICE);
        context.sendBroadcast(intent);
    }

    public static void sendQRCodeBroadcast(Context context) {
        Intent intent = new Intent(ACTION_QRCODE);
        context.sendBroadcast(intent);
    }

    public static void sendInventoryBroadcast(Context context) {
        Intent intent = new Intent(ACTION_INVENTORY);
        context.sendBroadcast(intent);
    }

    public static void sendTimerSwitchBroadcast(Context context) {
        Intent intent = new Intent(ACTION_TIMERSWITCH);
        context.sendBroadcast(intent);
    }
    public static void sendDownloadUpdateBroadcast(Context context, String url) {
        Intent intent = new Intent(ACTION_DOWNLOAD_UPDATE);
        intent.putExtra(ACTION_CONTENT,url);
        context.sendBroadcast(intent);
    }
}
